package com.itlong.cloud.resource;

import com.itlong.cloud.common.network.tcp.mina.IMinaServiceClient;
import com.itlong.cloud.enumerate.ecode.AppErrorCodeEnum;
import com.itlong.cloud.enumerate.oldapp.Code;
import com.itlong.cloud.service.IMinaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * <desc>
 *
 * </desc>
 */
@RestController
public class MinaServiceResource implements IMinaServiceClient {
    @Autowired
    private IMinaService iMinaService;

    /**
     * <desc>
     *
     * </desc>
     *
     * @param key
     * @param message 发送的消息
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/07
     */
    @Override
    @RequestMapping("/network/mina/sendMessage")
    public AppErrorCodeEnum sendMessage(@RequestParam("key") String key, @RequestParam("message") String message) {
        return iMinaService.sendMessage(key,message);
    }

    /**
     * <desc>
     *
     * </desc>
     *
     * @param key
     * @param message 发送的消息
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/07
     */
    @Override
    @RequestMapping(path = "/network/mina/oldSendMessage",method = {RequestMethod.POST})
    public Code oldSendMessage(@RequestParam("key") String key, @RequestParam("message") String message) {
        return iMinaService.oldSendMessage(key,message);
    }

}
